<template>
  <div class="home">
    <top-view />
    <sale-view />
    <bottom-view />
    <map-view />
  </div>
</template>

<script>
import TopView from '../components/TopView'
import SaleView from '../components/SaleView'
import BottomView from '../components/BottomView'
import MapView from '../components/MapView'
import { wordcloud, mapScatter, screenData } from '../api/report'
export default {
  name: 'Home',
  components: {
    TopView,
    SaleView,
    BottomView,
    MapView
  },
  data () {
    return {
      reportData: {},
      mapData: {},
      wordcloud: {}
    }
  },
  methods: {
    getReportData () {
      return this.reportData
    },
    getWordCloud () {
      return this.wordcloud
    },
    getMapData () {
      return this.mapData
    }
  },
  provide () {
    return {
      getReportData: this.getReportData,
      getWordCloud: this.getWordCloud,
      getMapData: this.getMapData
    }
  },
  mounted () {
    wordcloud().then(data => {
      this.wordcloud = data
    })
    mapScatter().then(data => {
      this.mapData = data
    })
    screenData().then(data => {
      this.reportData = data
    })
  }
}
</script>
<style scoped>
  .home{
    width: 100%;
    padding: 20px;
    box-sizing: border-box;
    background: #eeeeee;
  }
</style>
